package com.niiwoo.civet.trade.dto.request;

import lombok.Getter;
import lombok.Setter;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * @Author: wuke
 * @Description:
 * @Date: Created in 15:34 2017/11/15
 */
@Setter
@Getter
public class SpeedLoanApplyRequestDTO implements Serializable {
    private static final long serialVersionUID = 2272724665939824220L;

    @NotNull(message = "用户Id不能为空")
    private String userId;

    // 标的申请来源（1、APP，2、H5活动，3、H5极速借, 4、融360）看枚举ProjectFromSourceEnum
    @NotNull(message = "借款来源不能为空")
    private Byte fromSource;

    @NotNull(message = "借款金额不能为空")
    private BigDecimal loanAmount;

    @NotNull(message = "借款期限不能为空")
    private Integer deadline;

    @NotNull(message = "借款标题不能为空")
    private String loanTitle = "";

    @NotNull(message = "经度不能为空")
    private String longitude;

    @NotNull(message = "纬度不能为空")
    private String latitude;

    @NotNull(message = "省份不能为空")
    private String province;

    @NotNull(message = "城市不能为空")
    private String city;

    @NotNull(message = "区不能为空")
    private String area;

    // 借款描述
    private String loanDesc;
    
    @NotNull(message = "通讯录不能为空")
    @Size(min = 1,message = "通讯录不能为空")
    private List<AddressInfoRequestDTO> addressInfoDTOList;

    @Valid
    @NotNull(message = "借款设备信息不能为空")
    private DeviceInfoRequestDTO deviceInfo;

    //使用红包Id
    private Long prizeId;

    //使用红包类型
    private Byte prizeType;

    @Setter
    @Getter
    public static class AddressInfoRequestDTO implements Serializable {
        private static final long serialVersionUID = -3945569012415982697L;
        //手机号码
        private String mobile;

        //联系人姓名
        private String remark;
    }

    @Setter
    @Getter
    public static class DeviceInfoRequestDTO implements Serializable {
        private static final long serialVersionUID = -8950604148777231929L;
        @NotNull(message = "设备ID不能为空")
        private String  deviceId;

        @Pattern(regexp="Android|iOS",message="操作系统类型错误")
        private String  os;

        //品牌类型
        private String  brandType;

        //是否双卡双待（0：否   1：是）
        private Byte    dsds;

        //设备状态（0：未越狱  1：已越狱）
        private Byte    deviceStatus;

        //借款时GPS
        private String  gps;

        //借款时IP
        private String  ip;

        //借款时网络类型
        private String  network;

        //WiFi的SSID
        private String  wifiSsid;

        //地图类型（0-高德 1-百度）
        private Byte mapType;

        //设备指纹信息
        private String blackBox;
    }
}
